package com.metaera.app.data.model;

/**
 * Author: LJD
 * Date: 2019/9/5
 * Desc: 基础响应模型
 */
public class BasicResponse<T> {

    private T data;
    private int code;
    private String message;

    public BasicResponse() {
    }

    public BasicResponse(T data) {
        this.code = 0;
        this.data = data;
    }

    public BasicResponse(T data, int code, String message) {
        this.data = data;
        this.code = code;
        this.message = message;
    }

    public boolean isSucceed() {
        return code == 200;
    }

    public int getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

    public T getData() {
        return data;
    }

    @Override
    public String toString() {
        return "BasicResponseEntity{" +
                "code=" + code +
                ", msg='" + message + '\'' +
                ", data=" + data +
                '}';
    }
}
